<!DOCTYPE html>
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Dashboard Template for Bootstrap</title>
    <!-- Bootstrap core CSS -->
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link th:href="@{/css/dashboard.css}" rel="stylesheet">
    <style type="text/css">

        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }
    </style>
</head>

<body>
<div th:replace="~{common/commons::topbar}"></div>

<div class="container-fluid">
    <div class="row">
        <div th:replace="~{common/commons::sidebar(active='depList.html')}"></div>

        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <h2>部门管理</h2>
            <!--添加员工按钮-->
            <a class="btn btn-sm btn-primary" th:href="@{/addDep}">添加</a>

            <div class="table-responsive">
                <table class="table table-striped table-sm">
                    <thead>
                    <tr>
                        <th>部门号</th>
                        <th>部门名称</th>
                        <th></th>
                    </tr>
                    </thead>
                    <input type="hidden" id="msg" th:value="${msg}" >
                    <input type="hidden" id="msgCode" th:value="${msgCode}" >
                    <tbody>
                    <tr th:each="dep:${departments}">
                        <td th:text="${dep.getId()}"></td>
                        <td th:text="${dep.getDepartmentname()}"></td>
                        <td >
                            <a class="btn btn-sm btn-danger" th:href="@{/delDep/}+${dep.id}">删除</a>
                        </td>
                    </tr>

                    </tbody>
                </table>
            </div>
        </main>
    </div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" th:src="@{/js/jquery-3.2.1.slim.min.js}"></script>
<script type="text/javascript" th:src="@{/js/popper.min.js}"></script>
<script type="text/javascript" th:src="@{/js/bootstrap.min.js}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.3.0/sweetalert2.all.min.js" integrity="sha512-HL3ljb5fSrMMfAiRxSP+EdI/KC1kl6gVIzCV7GaJ4yFWCpnrcGxPAmytnKk9KNigFhyICxOlgD+uuaS07t7RdQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
    $(function(){
        hint1();//页面加载时加载
    })
    function hint1(){
        // var message1=document.getElementById("msg1").value;
        // var messageCode1=document.getElementById("messageCode1").value;
        var msg1=$("#msg").val();//获取id为msg1隐藏域的value值
        var msgCode1=$("#msgCode").val();//获取Id为msgCode1隐藏域的value值
        console.log("msg:",msg1);
        console.log("messageCode:",msgCode1);
        if (msg1!=""&&msg1!=null){
            msg(msg1,msgCode1);
        }

    }
    function msg(mge,messageCode){
        if (messageCode == "200") {
            Swal.fire({
                icon: "success",
                title: "提示",
                text: mge,
                showConfirmButton: false,
                timerProgressBar: true,
                timer: 1500
            });
        } else {
            Swal.fire({
                icon: "error",
                title: "提示",
                text: mge,
                showConfirmButton: false,
                timerProgressBar: true,
                timer: 2500
            });
        }
    }
</script>
</body>
</html>